home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / appkit.368 < prev    next >
Text File  |  1992-02-06  |  1KB  |  39 lines

  1. {\rtf0\ansi{\fonttbl\f2\fnil Times-Roman;\f0\fmodern Courier;}
  2. \paperw11840
  3. \paperh7740
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f2\b0\i0\ul0\fs28 printing context DPSSetContext NXRunAlertPanel \
  7. \
  8. Q: During printing, the view that is printing can't also write to the screen using a modal panel.  If I want to query the user for values to pass to the printing machinery while printing, such as adjusting the percentage of a view to be pushed to the next page, I can't use 
  9. \b NXRunAlertPanel
  10. \b0 ().\
  11. \
  12. A: Yes, true.  During printing the active PostScript context is pointing at the printer --- thus all PostScript to draw your panel goes to the printer and not the screen. The solution is to temporarily divert the PostScript to the Window Server context with something like:
  13. \fs24 \
  14. \
  15.  
  16. \pard\tx740\tx1420\tx2040\tx2780\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0     \{\
  17.         DPSContext oldContext;\
  18.         short oldStatus;\
  19.         \
  20.         oldContext = DPSGetCurrentContext();\
  21.         DPSSetContext([NXApp context]);    // talk to the server\
  22.         oldStatus = NXDrawingStatus;\
  23.         NXDrawingStatus = NX_DRAWING;\
  24. \
  25.         // You can do drawing to the screen here; use\
  26.         // NXRunAlertPanel(), etc...\
  27. \
  28.         NXDrawingStatus = oldStatus;\
  29.         DPSSetContext(oldContext);    // return to talking to printer\
  30.     \}\
  31. \
  32.  
  33. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f2\fs28 QA368\
  34. \
  35. Valid for 1.0\
  36. Valid for 2.0\
  37. \
  38.  
  39.